package com.stu.demo0519.demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 姚东名
 * Date: 2024-05-19
 * Time: 22:19
 */
public class Test {
    public static void main(String[] args) {
        //再谈静态代码块 实例代码块 构造代码块
        //1.静态代码块 优先 只会执行一次
        Cat cat = new Cat("小咪", 15);
        System.out.println("=================");
        Cat cat1 = new Cat("小咪", 15);
        //2.先执行父类和子类的静态代码块
        //3.再执行父类的实例代码块和父类的构造代码块
        //4.最后执行子类的实例代码块子类的构造代码块
    }
    public static void main1(String[] args) {
        //对象的实例化：
        Dog dog = new Dog("旺财", 10);
        dog.eat();
        dog.bark();
        System.out.println("=========================");
        Dog dog1 = new Dog();
        System.out.println(dog1.name);
        Cat cat = new Cat("小咪", 15);
        cat.mimi();

    }
}
